/*
Copyright (c), 1999, 2000 - phpauction
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation (version 2 or later).
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
require('./includes/messages.inc.php');
require('./includes/config.inc.php');
$pos_count = 0;
$page = (int)$page;
if ($page==0)
$page = 1;
$lines = (int)$lines;
if ($lines==0)
$lines = 25;
$left_limit = ($page-1)*$lines;
// Saldo eventl. offener Posten holen
$result = mysql_query ( "SELECT SUM(value) as summe FROM accountpos WHERE user_id='$user_id' AND closed='0'" );
$kontostand = mysql_result($result,0,"summe");
$rsl = mysql_query ( "SELECT count(*) FROM accountpos WHERE user_id='$user_id' AND closed='0'" );
if ($rsl) {
$hash = mysql_fetch_array($rsl);
$total = (int)$hash[0];
} else
$total = 0;
$pages = (int)($total/$lines);
if (($total % $lines)>0)
++$pages;
$result = mysql_query ( "SELECT * FROM accountpos WHERE user_id='$user_id' AND closed='0' ORDER BY date DESC LIMIT $left_limit,$lines" );
if ($result)
{
$tplh = "Offene Posten: ";
if (doubleval($kontostand > 0))
{
$kontocolor = " Soll ";
}
else
{
$kontocolor = " Guthaben ";
}
$realer_kontostand = 0 - $kontostand;
$tplh .= $kontocolor.print_money($realer_kontostand);
$tplh .= "";
// ##################################################################################################################
$tplv = "";
$bgColor = "#EBEBEB";
while ($row=mysql_fetch_array($result))
{
$value = $row[value];
$value = 0 - $value;
$starting_price = $row[minimum_bid];
if($bgColor == "#EBEBEB"){
$bgColor = "#FFFFFF";
}else{
$bgColor = "#EBEBEB";
}
//////////////////////////
$bm_date = substr($row[date], 8,2).".";
$bm_date .= substr($row[date], 5,2).".";
$bm_date .= substr($row[date], 0,4);
list ($re_date)= explode('-', $re_date);
$tplv .= "
";
$tplv .= "".$bm_date." | ";
$tplv .= "".$row[auction_id]." | ";
$tplv .= "".htmlspecialchars($row[description])."";
$tplv .=" | ".""."";
$tplv .= " | ";
$tplv .= "".print_money($value)." | ";
$tplv .= " | ";
$tplv .= "
";
++$pos_count;
}
$TPL_auctions_list_value = $tplv;
}
else
$pos_count = 0;
if ($pos_count==0)
{
$TPL_auctions_list_value = "$MSG_910 |
";
}
else
{
$TPL_auctions_list_value .= "$std_font"." "."$MSG_290_1 $total "."$MSG_289 $pages ($lines $MSG_291_1) "."Seite: ";
for ($i=1; $i<=$pages; ++$i) {
$TPL_auctions_list_value .=($page==$i)?" $i ":" $i ";
}
$TPL_auctions_list_value .=" |
";
if ($pos_count==0)
$TPL_auctions_list_value = "$std_font"."$ERR_114 |
";
}
$query = "SELECT * FROM users WHERE id='".htmlspecialchars($user_id) . "'";
$result = mysql_query ( $query );
if ($result)
{
if (mysql_num_rows($result)>0)
$TPL_user_nick = mysql_result ($result,0,"nick");
else
$TPL_user_nick = "";
}
else
$TPL_user_nick = "";
// Rechnungen vorhanden?
$r_query = "SELECT * FROM invoices WHERE user_id='$user_id' AND closed='0'";
$r_result = mysql_query($r_query);
if(!$r_result)
{
print "Datenbankfehler: Kontaktieren Sie bitte den Webmaster!".mysql_error();
exit;
}
$num_rech = mysql_num_rows($r_result);
$m = 0;
$tplr = "Offene Rechnungen
";
$tplr.= "";
$tplr.= "Rechnung-Nr. | ";
$tplr.= "Rechnung-Datum | ";
$tplr.= "Rechnung-Betrag | ";
$tplr.= "Details | ";
$tplr.= "* | ";
$tplr.= "* | ";
$tplr.= "* |
";
while($m < $num_rech)
{
$re_nummer = mysql_result($r_result,$m,"id");
$re_date = mysql_result($r_result,$m,"date");
$re_betrag = mysql_result($r_result,$m,"value");
$re_mahn1 = mysql_result($r_result,$m,"mahn1");
$re_mahn2 = mysql_result($r_result,$m,"mahn2");
$re_mahn3 = mysql_result($r_result,$m,"mahn3");
$datum = substr($re_date,8,2).".";
$datum.= substr($re_date,5,2).".";
$datum.= substr($re_date,0,4);
list ($re_date)= explode('-', $re_date);
if ($bgcolor="#FFFFFF")
{
$bgcolor="#EEEEEE";
}
else
{
$bgcolor="#FFFFFF";
}
$tplr.= "";
$tplr.= "".$ers_font.$re_nummer." | ";
$tplr.= "".$ers_font.$datum." | ";
$tplr.= "".$ers_font.print_money($re_betrag)." | ";
$tplr.= "".$ers_font."Rechnungsposten anzeigen | ";
if (intval($re_mahn1)>0)
{
$m1_datum = substr($re_mahn1,8,2).".";
$m1_datum.= substr($re_mahn1,5,2).".";
$m1_datum.= substr($re_mahn1,0,4);
$tplr.= "".$sml_font."1. Mahnung: ".$m1_datum." | ";
}
else
{
$tplr.= "".$std_font."- | ";
}
if (intval($re_mahn2)>0)
{
$m2_datum = substr($re_mahn2,8,2).".";
$m2_datum.= substr($re_mahn2,5,2).".";
$m2_datum.= substr($re_mahn2,0,4);
$tplr.= "".$sml_font."2. Mahnung: ".$m2_datum." | ";
}
else
{
$tplr.= "".$std_font."- | ";
}
if (intval($re_mahn3)>0)
{
$m3_datum = substr($re_mahn3,8,2).".";
$m3_datum.= substr($re_mahn3,5,2).".";
$m3_datum.= substr($re_mahn3,0,4);
$tplr.= "".$sml_font."3. Mahnung: ".$m3_datum." | ";
}
else
{
$tplr.= "".$std_font."- | ";
}
$m++;
}
$tplr.= "
";
// Ende Rechnungen ########################
include "header.php";
include "templates/template_user_account_header_php.html";
include "templates/template_user_account.html";
include "footer.php";
exit;
?>